<?php

/**
 * ProjectMaintainer form base class.
 *
 * @method ProjectMaintainer getObject() Returns the current form's model object
 *
 * @package    packagesdispenser
 * @subpackage form
 * @author     Nicolas Surian aka NairuS <contact@nairus.fr>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProjectMaintainerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'project_id'    => new sfWidgetFormInputHidden(),
      'maintainer_id' => new sfWidgetFormInputHidden(),
      'type'          => new sfWidgetFormChoice(array('choices' => array('lead' => 'lead', 'developer' => 'developer'))),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'project_id'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('project_id')), 'empty_value' => $this->getObject()->get('project_id'), 'required' => false)),
      'maintainer_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('maintainer_id')), 'empty_value' => $this->getObject()->get('maintainer_id'), 'required' => false)),
      'type'          => new sfValidatorChoice(array('choices' => array(0 => 'lead', 1 => 'developer'), 'required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('project_maintainer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ProjectMaintainer';
  }

}
